<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>Promise核心</title>
	<style type="text/css">
	body {
		padding: 30px;
	}

</style>
</head>
<body>
	<div id="hd"></div>
	<div id="hd2"></div>
	<script src="index.js"></script>
	<script type="text/javascript">
let p1 = new HD((resolve, reject) => {
  setInterval(() => {
    resolve("后盾人");
  }, 2000);
});
let p2 = new HD((resolve, reject) => {
  setInterval(() => {
    reject("houdunren.com");
  }, 1000);
});
let promises = HD.race([p1, p2]).then(
  promises => {
    console.log(promises);
  },
  reason => {
    console.warn(reason);
  }
);

	</script>
</body>
</html>